package operation;

import book.Book;
import book.BookList;

import java.util.Scanner;

public class BorrowedOperation implements IOPeration {
    @Override
    public void work(BookList bookList) {
        System.out.println("借阅图书");
        System.out.println("请输入书名");
        Scanner scanner = new Scanner(System.in);
        String name = scanner.nextLine();
        int currentSize = bookList.getUsedsize();
        for (int i = 0; i < currentSize - 1; i++) {
            //从数组上面找书
            Book book=bookList.getBook(i);
            if (book.getName().equals(name)) {
                System.out.println("拿好你的书");
                //借出不用删除书，直接写被借出就行了
                book.setBorrowed(true);
                break;
                }
            else {
                System.out.println("你没这本书");
                break;
            }
        }
        //修改boolea函数


    }
}
